<?php
	require 'header.php';
	include 'NodeSwitcher.php'; 
	//print_r( node_load($_GET['und']) );
	 
	$title = node_load($_GET['und']) -> title;
	
	$time = node_load($_GET['und']) -> field_package_date["und"][0][value];
	

	//$content = node_load($_GET['und']) -> body["und"][0][value];
	
	// if(!isset($content)||node_load($_GET['und']) -> field_events_description["und"][0][value]){
	// 	$content=node_load($_GET['und']) -> field_events_description["und"][0][value];
	// }

	$price = node_load($_GET['und']) -> field_price;
	
	
	//includes table
	foreach (node_load($_GET['und']) -> field_includes["und"] as $record) {
  	 	$includes .= $record[value]."<hr>";
    } 
	 
	$bookingURL = db_select("field_data_field_bookinglink", "f")
    ->fields("f", array("field_bookinglink_url")) 
	->condition('entity_id', $_GET['und']) 
    ->execute()
    ->fetchField();
  	$bookNow="";
	 if(isset($bookingURL)&&strlen($bookingURL)>0){
	 	$bookNow= "<div id='bookNow'><a href='".$bookingURL."'><img src='img/bookNow.png' ></img></a></div>";
	 }

	 $NodeSwitcher=new NodeSwitcher(node_load($_GET['und']),$image_url);
	 $imgHtml=$NodeSwitcher->getImgHtml();
	 $content=$NodeSwitcher->getContentHtml();

	echo $title;
	echo "<br/>";
	  
	echo $time;
	echo "<br/>";
	
	echo $content;
	echo "<br/>";
	
	echo $includes;
	echo "<br/>";
	

	
	echo node_load($_GET['und']) -> field_price[und][0][value];	
	echo node_load($_GET['und']) -> field_price_unit[und][0][value];
	echo "<br/>";
?>  
<style>
#bookNow 
{
	position:absolute;
	right:280px;
	top:450px;
	z-index:10;
}

	
</style>
<body>
 
<div data-role="page" class="jqm-demos jqm-demos-home">


	<div data-role="header" class="jqm-header">
		<h1 class="jqm-logo"><img src="./img/callaway_gardens_logo.png" alt="CallawayGarden"></h1> 
        <nav>
				<ul>
					<li><a href="<?=$bookingURL?>">BOOK</li> 
					<li><a href="#">MAPS</a></li> 
					<li><a href="#">CALENDAR</a></li> 
				</ul>
		</nav> 
	</div><!-- /header -->
			<div data-role="content" class="jqm-content" role="main">
				<?//print_r( node_load($_GET['und'])) ;	?>
		<? if($imgHtml){ ?>		
		<div class = 'container' data-inline="true">			 
			<div class = 'iosSlider'>	
            		
				<div class = 'slider'> 
                     
					 <?php 
					 	
					 	echo $imgHtml;
					 
					 ?> 
                    
				</div> 
                 

			</div>	

		</div><!-- ios slider --> 
		<?}?>
		<?echo $bookNow;?>
        <div class="jqm-home-welcome">
            <h2><?php echo $title; ?></h2>
            
            <div class="main">
				<?php 
					echo $content;
					echo "<br/>";
					
					if($includes){
						echo "<div class='field-label'>Includes:</div>";
						echo $includes;
						echo "<br/>";
					} 
					
					echo "<div class='field-name-field-price'>";
					echo node_load($_GET['und']) -> field_price[und][0][value];
					echo "<br/>";
					echo node_load($_GET['und']) -> field_price_unit[und][0][value];
					echo "</div>";
				?>
            </div>
     
		</div>
        
	</div><!-- /content -->

	<div data-role="footer" class="jqm-footer ui-footer ui-bar-a" role="contentinfo"> 
		 <p>Copyright 2013 The jQuery Foundation</p>
	</div>

</div><!-- /page -->
</body>
</html>




	